<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>文字内容逐渐显示</title>
</head>
<body>

<div id="show" style="opacity: 0">双十一购物街快乐</div>

<script>

    let element = document.getElementById("show")
    let opacity = 0
    setInterval(function () {
        // console.log(element.style.opacity);
        opacity += 0.02
        element.style.opacity = opacity.toString()
        console.log(element.style.opacity);
        if (opacity > 1) {
            opacity = 0
        }
    }, 50)
</script>
</body>
</html>